package com.polymathcoder.dpastry.api.pastry;

import java.io.Serializable;

/**
 * Created by IntelliJ IDEA.
 * User: Drew
 * Date: Jul 5, 2010
 * Time: 12:32:48 AM
 * To change this template use File | Settings | File Templates.
 */
public interface Message extends Serializable {
    // different priority levels
    public static final int MAX_PRIORITY = -15;
    public static final int HIGH_PRIORITY = -10;
    public static final int MEDIUM_HIGH_PRIORITY = -5;
    public static final int MEDIUM_PRIORITY = 0;
    public static final int MEDIUM_LOW_PRIORITY = 5;
    public static final int LOW_PRIORITY = 10;
    public static final int LOWEST_PRIORITY = 15;
    public static final int DEFAULT_PRIORITY = MEDIUM_PRIORITY;

    /**
     * Method which should return the priority level of this message.  The messages
     * can range in priority from -15 (highest priority) to 15 (lowest) -
     * when sending messages across the wire, the queue is sorted by message priority.
     * If the queue reaches its limit, the lowest priority messages are discarded.  Thus,
     * applications which are very verbose should have LOW_PRIORITY or lower, and
     * applications which are somewhat quiet are allowed to have MEDIUM_PRIORITY or
     * possibly even HIGH_PRIORITY.
     *
     * @return This message's priority
     */
    public int getPriority();
}
